/**
 * Kano
 *
 */
class Kano extends tool.Animation {
    private left_stand: number = 1;
    private _instruct: number = 0;
    /** 接收指令 */
    public set instruct(num:number) {
        this._instruct = num;
        this.instrData = DataConfig.kano[this._instruct];
        this.exeInstr();
    }
    private instrData: any;//指令动作
    public constructor() {
    	   super();
        //初始位置
        this.bottom = 20;
        this.left = 15;
        this.right;
        this.top;
        this.instruct = this.left_stand;
    }
    //获取指令
    private exeInstr() {
        this.endInstr();
    }
    /** 获取指令数据 */
    public getData () {
        this.souceJSON = this.instrData;
    }
    //监听一轮播放完成事件
    public onComplete() {
        if(this.isReplay){
            this.stop();
            this.getData();
        }
        else {
            this.exeLastAction();
        }
    }
    //随时终止指令执行新命令
    private endInstr () {
        if(!this.isOnce) {
            if(this.souceJSON == this.instrData["json"]) {
                return;
            }
            this.stop();
            this.getData();
        }
    }
    public exeDefaultAction() {
        this.instruct = this.lastAct;
    }
    /***
     * 动作完毕调用此函数执行默认动作
     */
    public exeLastAction() {
        this._instruct = this.lastAct;
        this.instrData = DataConfig.kano[this._instruct];
        this.stop();
        this.getData();
    }
}
